﻿// b.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
// 
// operator<<  操作符的使用

#include <iostream>
#include <ostream>

using namespace std;

class OpOver
{
public:
	OpOver(int i = 0, int j = 0) { a = i; b = j; };
	friend ostream& operator<<(ostream&, const OpOver&);
	void add() {
		a++;
	}
	int getA() {
		return a;
	}
	int getB() {
		return b;
	}
private:
	int a;
	int b;
};
ostream& operator<<(ostream& os, OpOver& rhs)
{
	rhs.add();
	os << rhs.getA() << "," << rhs.getB();
	return os;
}
int main()
{
	OpOver oo(2, 3);
	cout << oo << oo << oo << endl;

    std::cout << "Hello World!\n";
}
